home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / TranslationExtensions.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  5.3 KB  |  174 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Easy Open 1.1
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1989-1997, 1995, 1997 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  19. __TRANSLATIONEXTENSIONS__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  25.     include 'Files.a'
  26.     ENDIF
  27.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  28.     include 'Quickdraw.a'
  29.     ENDIF
  30.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  31.     include 'Components.a'
  32.     ENDIF
  33.  
  34.  
  35. kSupportsFileTranslation        EQU        1
  36. kSupportsScrapTranslation        EQU        2
  37. kTranslatorCanGenerateFilename    EQU        4
  38.  
  39. ;  better names for 4-char codes
  40. ; typedef OSType                         FileType
  41.  
  42. ; typedef ResType                         ScrapType
  43.  
  44. ; typedef unsigned long                 TranslationAttributes
  45.  
  46.  
  47. taDstDocNeedsResourceFork        EQU        1
  48. taDstIsAppTranslation            EQU        2
  49.  
  50. FileTypeSpec            RECORD 0
  51. format                     ds.l    1                ; offset: $0 (0)
  52. hint                     ds.l    1                ; offset: $4 (4)
  53. flags                     ds.l    1                ; offset: $8 (8)        ;  taDstDocNeedsResourceFork, taDstIsAppTranslation
  54. catInfoType                 ds.l    1                ; offset: $C (12)
  55. catInfoCreator             ds.l    1                ; offset: $10 (16)
  56. sizeof                     EQU *                    ; size:   $14 (20)
  57.                         ENDR
  58. FileTranslationList        RECORD 0
  59. modDate                     ds.l    1                ; offset: $0 (0)
  60. groupCount                 ds.l    1                ; offset: $4 (4)
  61. ;      unsigned long    group1SrcCount;
  62. ;      unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  63. ;   FileTypeSpec    group1SrcTypes[group1SrcCount]
  64. ;   unsigned long    group1DstCount;
  65. ;   unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  66. ;   FileTypeSpec    group1DstTypes[group1DstCount]
  67. sizeof                     EQU *                    ; size:   $8 (8)
  68.                         ENDR
  69. ; typedef struct FileTranslationList *    FileTranslationListPtr
  70.  
  71. ; typedef FileTranslationListPtr *        FileTranslationListHandle
  72.  
  73.  
  74. ScrapTypeSpec            RECORD 0
  75. format                     ds.l    1                ; offset: $0 (0)
  76. hint                     ds.l    1                ; offset: $4 (4)
  77. sizeof                     EQU *                    ; size:   $8 (8)
  78.                         ENDR
  79. ScrapTranslationList    RECORD 0
  80. modDate                     ds.l    1                ; offset: $0 (0)
  81. groupCount                 ds.l    1                ; offset: $4 (4)
  82. ;      unsigned long        group1SrcCount;
  83. ;      unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  84. ;   ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  85. ;   unsigned long        group1DstCount;
  86. ;      unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  87. ;   ScrapTypeSpec        group1DstTypes[group1DstCount]
  88. sizeof                     EQU *                    ; size:   $8 (8)
  89.                         ENDR
  90. ; typedef struct ScrapTranslationList *    ScrapTranslationListPtr
  91.  
  92. ; typedef ScrapTranslationListPtr *        ScrapTranslationListHandle
  93.  
  94. ;  definition of callbacks to update progress dialog
  95. ; typedef long                             TranslationRefNum
  96.  
  97. ; *****************************************************************************************
  98. ;*
  99. ;* This routine sets the advertisement in the top half of the progress dialog.
  100. ;* It is called once at the beginning of your DoTranslateFile routine.
  101. ;*
  102. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  103. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  104. ;*                            Before returning from DoTranslateFile, you should dispose
  105. ;*                            of the memory.  (Normally, it is in the temp translation heap
  106. ;*                            so it is cleaned up for you.)
  107. ;*
  108. ;* Exit:    returns            noErr, paramErr, or memFullErr
  109. ;
  110.  
  111. ;
  112. ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  113. ;
  114.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  115.         Macro
  116.         _SetTranslationAdvertisement
  117.             moveq               #2,D0
  118.             dc.w                $ABFC
  119.         EndM
  120.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  121.         IMPORT_CFM_FUNCTION SetTranslationAdvertisement
  122.     ENDIF
  123.  
  124.  
  125. ; *****************************************************************************************
  126. ;*
  127. ;* This routine updates the progress bar in the progress dialog.
  128. ;* It is called repeatedly from within your DoTranslateFile routine.
  129. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  130. ;*
  131. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  132. ;*            progress    percent complete (0-100)
  133. ;*
  134. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  135. ;*            returns        noErr, paramErr, or memFullErr
  136. ;
  137.  
  138. ;
  139. ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  142.         Macro
  143.         _UpdateTranslationProgress
  144.             moveq               #1,D0
  145.             dc.w                $ABFC
  146.         EndM
  147.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  148.         IMPORT_CFM_FUNCTION UpdateTranslationProgress
  149.     ENDIF
  150.  
  151.  
  152.  
  153. ;  ComponentMgr selectors for routines
  154.  
  155. kTranslateGetFileTranslationList EQU    0                    ; component selectors
  156. kTranslateIdentifyFile            EQU        1
  157. kTranslateTranslateFile            EQU        2
  158. kTranslateGetTranslatedFilename    EQU        3
  159. kTranslateGetScrapTranslationList EQU    10                    ; skip to scrap routines
  160. kTranslateIdentifyScrap            EQU        11
  161. kTranslateTranslateScrap        EQU        12
  162.  
  163. ;  Routines to implment in a file translation extension
  164.  
  165.  
  166.  
  167. ;  Routine to implement in a scrap translation extension
  168.  
  169.  
  170.  
  171.  
  172.     ENDIF ; __TRANSLATIONEXTENSIONS__ 
  173.  
  174.